/*
 
 File: audio_helper.h
 
 Abstract: Helper functions for acquiring audio data
 
 Portions of this file taken from Apple demo code.
 
 Author: Jasper Speicher, Tellart LLC 2008
 
 */

#if !defined(__rio_helper_h__)
#define __rio_helper_h__

#include "CAStreamBasicDescription.h"

extern int drawBufferIdx;
extern int drawBufferLen;
extern int drawBufferLen_alloced;
extern SInt8 *drawBuffers[];

//these could be constants, but we may want to change the frequency programatically in the near future
extern float sine_amp;
extern float sine_freq;

//the sinusoid lookup table
extern float lut[44100];


void rioInterruptionListener(void	*inUserData, UInt32	inInterruption);
int SetupRemoteIO (AudioUnit& inRemoteIOUnit, AURenderCallbackStruct inRenderProcm, CAStreamBasicDescription& outFormat);
void SineData(AudioBufferList *ioData);
AudioSampleType GetPeakAmp(AudioBufferList *ioData);
float SinfLut(float t);
void PopulateSinfLut();

#endif